package com.taptech.doufu.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.taptech.doufu.R;

import androidx.annotation.NonNull;

/**
 * Created by Wyatt on 2017/9/18/018.
 */

public class PermissionTipDialog extends Dialog{
    private TextView tvBtn;
    private View layClose;
    private TextView tvContent;
    private TextView tvPre;
    private OnBtnClickListener mListener;
    public PermissionTipDialog(@NonNull Context context) {
        super(context,R.style.updateDialog);
    }


    public void setOnBtnClickListener(OnBtnClickListener listener) {
        mListener = listener;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_permission_tip);
        tvPre = (TextView) findViewById(R.id.tv_pre);
        tvBtn = (TextView) findViewById(R.id.tvBtn);
        layClose = findViewById(R.id.layClose);
        tvContent  = findViewById(R.id.tv_content);
        layClose.setOnClickListener(v -> {
            dismiss();
        });
        tvBtn.setOnClickListener(v -> {
            if (mListener != null) {
                mListener.onClick();
            }
            dismiss();
        });
    }

    public void setPre(String content){
        tvPre.setText(content);
    }

    public void setContent(String content){
        tvContent.setText(content);
    }


    public interface OnBtnClickListener{
        void onClick();
    }
}
